package pl.enigmatic.parser.string.javax.vecmath;

import javax.vecmath.Point2d;

import pl.enigmatic.parser.string.ArrayConverter;
import pl.enigmatic.parser.string.Converter;


public class Point2dConverter extends Converter<Point2d> {

	private final ArrayConverter<Double> array = new ArrayConverter<Double>(Double[].class);

	@Override
	public Point2d convert(String value) {
		Double[] d = array.convert(value);
		return new Point2d(d[0], d[1]);
	}

	@Override
	public String convertBack(Point2d value) {
		return array.convertBack(new Double[] { value.x, value.y });
	}

}
